home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 10
/
FM Towns Free Software Collection 10.iso
/
ms_dos
/
tool
/
txf
/
src
/
txf.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-09-17
|
6KB
|
223 lines
/*====================================================================
*
* TXF common include file
*
*====================================================================
* copyright(C) 1992-1994 T.Nakatani
*====================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <jctype.h>
#include <jstring.h>
#include <dos.h>
#include <io.h>
#include <fcntl.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <farstr.h>
/*====================================================================
* common definition
*====================================================================
*/
#define NUL '\0'
#define TAB 0x09
#define RET 0x0A
#define CR 0x0D
#define LF 0x0A
#define TRUE 1
#define FALSE 0
#define MAX_STR 9
#define EX_MAX 300
#define PARA_MAX 3000
#define KFL_MAX 160
#define KQ__MAX 80
#define NP_DEL 4
/*====================================================================
* grobal variable
*====================================================================
*/
#ifdef MAIN
char inputfile[80]; /* -i */
char outputfile[80]; /* -o */
char wcfile[80]; /* -io */
char bakfile[80]; /* -rb */
int tabsize=8; /* -t */
int tabx=0; /* -x tab展開 */
int maxc=76; /* -l */
int cent=0; /* -c */
int left=-1; /* -ml */
int right=-1; /* -mr */
int retflg=0; /* -r */
int quoteflg=0; /* -q 引用文 */
int base=-1; /* -b */
char tfile[2][64]; /* -d */
int exflg=0; /* -e */
int format=1; /* -n,-f */
int viewmode=0; /* -v */
char sep=0x22; /* -s */
int removeeofflg=0; /* -rz */
int removebakfile=0; /* -rb */
int setline=0; /* -z */
int ishflg = 0;
int ishline = 0;
int ishmax = 0;
char *ishptr;
char linestr[8];
char quotemarker[20] = "";
char quoteend[20] = "";
unsigned long starttxf = 0L;
unsigned long endtxf = 0L;
int read_def_flg = 1;
int command_option = 0;
int tmpinfile;
char far *exold[EX_MAX], far *exnew[EX_MAX], far *exattr[EX_MAX];
char far *exptr[EX_MAX], far *exattrptr[EX_MAX]; /* -e */
char far *para[PARA_MAX];
char *kl, *kf, *kq;
char ishchr[80] = "%&')+,?/2456789:;<=>ABCDEFGHIKLNORTUVWXYZ[\\]^abcdefghijklmnpqrstuvxyz|。」";
char ishhead1[36] = "<<< ^2( use ish^1) [ ^1 lines ] >>>";
char ishhead2[28] = "--- ^2 (12345/12345) ---";
int quote=0;
char *basedir;
FILE *input,*output;
int outputh, inputh;
signed long fsize;
unsigned int rbufsize = 65530;
time_t ftime[2];
/* use commandfile */
char far *fbuf;
int fbufsize=0,fbufptr=0;
#endif
/*====================================================================
* external variable
*====================================================================
*/
extern int tmpinfile;
extern char inputfile[80]; /* -i */
extern char outputfile[80]; /* -o */
extern char wcfile[80]; /* -io */
extern char bakfile[80]; /* -rb */
extern int tabsize; /* -t */
extern int tabx; /* -x tab展開 */
extern int maxc; /* -l */
extern int cent; /* -c */
extern int left; /* -ml */
extern int right; /* -mr */
extern int retflg; /* -r */
extern int quoteflg; /* -q 引用文 */
extern int base; /* -b */
extern char tfile[2][64]; /* -d */
extern int exflg; /* -e */
extern int format; /* -n,-f */
extern int viewmode; /* -v */
extern char sep; /* -s */
extern int removeeofflg; /* -rz */
extern int removebakfile; /* -rb */
extern int setline; /* -z */
extern int ishflg;
extern int ishline;
extern int ishmax;
extern char *ishptr;
extern char linestr[8];
extern char quotemarker[20];
extern char quoteend[20];
extern unsigned long starttxf;
extern unsigned long endtxf;
extern int read_def_flg;
extern int command_option;
extern char far *exold[], far *exnew[], far *exattr[];
extern char far *exptr[], far *exattrptr[];/* -e */
extern char far *para[];
extern char *kl, *kf, *kq;
extern char ishchr[80];
extern char ishhead1[36];
extern char ishhead2[28];
extern int quote;
extern char *basedir;
extern FILE *input,*output;
extern int outputh, inputh;
extern signed long fsize;
extern unsigned int rbufsize;
extern time_t ftime[2];
extern char far *fbuf;
extern int fbufsize,fbufptr;
/*====================================================================
* external function
*====================================================================
*/
void setleft(void);
void setleft0(void);
int putspace(int num, FILE *file);
/* int putspace(int num, unsigned int handle); */
int findret(int ox, int iy, char far *rptr);
int putret(int ox, char far *rptr);
int linelen(char far *ptr);
int levelchk(unsigned long int line);
int ishchk(char far *ptr);
void exchange(void);
void exchangedriver(void);
void read_def(char *own);
void savemem(char chr);
void read_commandfile(char *commandfile, int level);
void savesw(int base);
int hex(char far *str);
char far *ftrans(char far *form);
int quotechk(char far *ptr);
char *strspc(char *ptr, char find);
char *ktrans(char far *str);
void init_allswitch(void);
void gettmpfile(void);
char *get_filename(char *wildcard);
void mktfilename(void);
void input_to_output(void);
void tfileopen(int i);
int wcchk(void);
void errexit(char *errmes);
void logicerr(char *str);
void credit(char *name);
void showswitch(void);
int matchstr(char *form, char far *txtptr);
void init(char *name);
void setdefault(void);
void txf(void);
void endoftxf(void);
int main(int argc, char **argv);
void removeeof(void);
void case_k(char c, char far *str);
void case_r(char c);
void case_e(char c);
int chkoprnd(char next);
char *nrcpy(char far *fstr);
void swlow(int *i, char far **val);
void swhigh(int *i, char far **val);
void swchk(int count, char far **val);
char far *buffileopen(int i);
char far *readnext(int val);
/* char *readbefore(int val); */
long int remainbyte(void);
void bufclose(void);
int chktouch(char far *rptr, int iy);
void txform(void);